package sporteam.web.client;

import java.io.Serializable;

import javax.jdo.annotations.EmbeddedOnly;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;

import com.google.gwt.user.client.rpc.IsSerializable;

@SuppressWarnings("serial")
@PersistenceCapable
@EmbeddedOnly
public class GeoPtr implements Serializable, IsSerializable {

	/** the speed is in m/s **/
	@Persistent
	float speed;
	@Persistent
	long time;
	@Persistent
	double altitude;
	@Persistent
	double latitude;
	@Persistent
	double longitude;
	@Persistent
	double calorie = 0;

	public GeoPtr() {
		this.latitude = 0;
		this.longitude = 0;
		this.time = 0;
		this.altitude = 0;
		this.speed = 0;
	}

	public GeoPtr(double latitude, double longitude, long time, float speed,
			double altitude) {
		this.latitude = latitude;
		this.longitude = longitude;
		this.time = time;
		this.altitude = altitude;
		if (speed * 3.6 < 1)
			this.speed = 0;
		else
			this.speed = speed;
	}

	/** get the speed in km/h **/
	public double GetSpeed() {
		return speed * 3.6;
	}

	public double getAltitude() {
		return altitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public double getTime() {
		return ((double) (time / 1000)) / 60;
	}

	public long getMS() {
		return time;
	}

	public double getCalories() {

		return calorie;
	}
}